pbr: 1.1.8-36 bugfixes
authorStan Grishin <[email protected]>
Mon, 18 Aug 2025 16:34:28 +0000 (16:34 +0000)
committerStan Grishin <[email protected]>
Tue, 19 Aug 2025 17:05:18 +0000 (10:05 -0700)
- drop load_environment_flag and always load environment on start, making
  restart command great again
- store/restore existing jshn namespace when using json()
- remove unneeded sleepCount in is_wan_up()
- move updated README inside files/

Signed-off-by: Stan Grishin <[email protected]>
net/pbr/Makefile
net/pbr/README.md [deleted file]
net/pbr/files/README.md
net/pbr/files/etc/init.d/pbr

index 05cc1e6ddf6720cb03d65432ff17d1ef56df8cb1..1cea31c7289f42ba3baa39c000a004862364bbe1 100644 (file)
@@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pbr
 PKG_VERSION:=1.1.8
-PKG_RELEASE:=34
+PKG_RELEASE:=36
 PKG_LICENSE:=AGPL-3.0-or-later
 PKG_MAINTAINER:=Stan Grishin <[email protected]>
 
diff --git a/net/pbr/README.md b/net/pbr/README.md
deleted file mode 100644 (file)
index 3a65c6b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Policy-Based Routing (pbr)
-
-[![OpenWrt](https://img.shields.io/badge/OpenWrt-Compatible-blueviolet)](https://openwrt.org)
-[![Web UI](https://img.shields.io/badge/Web_UI-Available-blue)](https://docs.openwrt.melmac.ca/pbr/)
-[![License](https://img.shields.io/badge/License-GPL--3.0-lightgrey)](https://github.com/stangri/pbr/blob/master/LICENSE)
-
-Flexible policy-based routing (PBR) framework for OpenWrt.  
-Allows routing specific traffic (by IP, MAC, port, protocol, or domain) through a specific WAN, VPN, or tunnel.
-
-## Features
-
-- Route by IP, MAC, port, or domain name
-- Works with WAN, VPNs (WireGuard, OpenVPN), or tunnels
-- Lightweight shell-based implementation
-- Optional Web UI integration via LuCI
-
-**Full documentation:**  
-[https://docs.openwrt.melmac.ca/pbr/](https://docs.openwrt.melmac.ca/pbr/)
index 494a97c138f663443c777ff97602af2e9ada1f66..3a65c6b2257cbd7b6d0451f182ac399e126be40c 100644 (file)
@@ -1,3 +1,18 @@
-# README
+# Policy-Based Routing (pbr)
 
-README is available at [https://docs.openwrt.melmac.net/pbr/](https://docs.openwrt.melmac.net/pbr/).
+[![OpenWrt](https://img.shields.io/badge/OpenWrt-Compatible-blueviolet)](https://openwrt.org)
+[![Web UI](https://img.shields.io/badge/Web_UI-Available-blue)](https://docs.openwrt.melmac.ca/pbr/)
+[![License](https://img.shields.io/badge/License-GPL--3.0-lightgrey)](https://github.com/stangri/pbr/blob/master/LICENSE)
+
+Flexible policy-based routing (PBR) framework for OpenWrt.  
+Allows routing specific traffic (by IP, MAC, port, protocol, or domain) through a specific WAN, VPN, or tunnel.
+
+## Features
+
+- Route by IP, MAC, port, or domain name
+- Works with WAN, VPNs (WireGuard, OpenVPN), or tunnels
+- Lightweight shell-based implementation
+- Optional Web UI integration via LuCI
+
+**Full documentation:**  
+[https://docs.openwrt.melmac.ca/pbr/](https://docs.openwrt.melmac.ca/pbr/)
index 043ccfb83ede795075030953cf616bb1c005e8c9..1f698ec4b2f304441db7acb694381e859ff50e9a 100755 (executable)
@@ -101,7 +101,6 @@ nft_set_policy=
 nft_set_timeout=
 
 # run-time
-load_environment_flag=
 aghConfigFile='/etc/AdGuardHome/AdGuardHome.yaml'
 gatewaySummary=
 wanIface4=
@@ -569,7 +568,6 @@ load_environment() {
                return "$_ret"
        }
        local param="$1" validation_result="$2"
-       [ -z "$load_environment_flag" ] || return 0
        case "$param" in
                on_boot|on_start)
                        json init
@@ -607,7 +605,6 @@ load_environment() {
                        load_network "$param"
                ;;
        esac
-       load_environment_flag=1
 }
 
 # shellcheck disable=SC2317
@@ -648,7 +645,7 @@ load_network() {
 }
 
 is_wan_up() {
-       local sleepCount='1' param="$1"
+       local param="$1"
        if [ -z "$(uci_get network "$procd_wan_interface")" ]; then
                json add error 'errorNoWanInterface' "$procd_wan_interface"
                json add error 'errorNoWanInterfaceHint'
@@ -864,8 +861,10 @@ cleanup_sets() {
 json() {
        local status message stats i
        local action="$1" param="$2" value="$3"; shift 3; local info="$*";
+       local _current_namespace="$_JSON_PREFIX"
        [ "$param" = 'error' ] && param='errors'
        [ "$param" = 'warning' ] && param='warnings'
+       json_set_namespace "${packageName}_"
        { json_load_file "$runningStatusFile" || json_init; } >/dev/null 2>&1
        case "$action" in
                'get')
@@ -882,6 +881,7 @@ json() {
                        fi
                        printf "%b" "$i"
                        json_select ..
+                       json_set_namespace "$_current_namespace"
                        return
                ;;
                'add')
@@ -903,6 +903,7 @@ json() {
        mkdir -p "${runningStatusFile%/*}"
        json_dump > "$runningStatusFile"
        sync
+       json_set_namespace "$_current_namespace"
 }
 
 resolver() {